from ctypes import *
import ctypes

class ECheckMethod(ctypes.Structure):
    _fields_ = [("em_DefectDetection", ctypes.c_int),
                ("em_DefectSegmentation", ctypes.c_int),
                ("em_DefectClassifier", ctypes.c_int),
                ("em_DefectKeyPoints", ctypes.c_int),
                ("em_FastDetection", ctypes.c_int)]

ECheckMethod.em_DefectDetection = 0
ECheckMethod.em_DefectSegmentation = 1
ECheckMethod.em_DefectClassifier = 2
ECheckMethod.em_DefectKeyPoints = 3
ECheckMethod.em_FastDetection = 4

class EDeviceType(ctypes.Structure):
    _fields_ = [("em_CPU", ctypes.c_int),
                ("em_GPU", ctypes.c_int),
                ("em_TensorRT", ctypes.c_int)]

EDeviceType.em_CPU = 0
EDeviceType.em_GPU = 1
EDeviceType.em_TensorRT = 2

class result_params(ctypes.Structure):
    _fields_ = [("current_batch", ctypes.c_int),
                ("current_loss", ctypes.c_float),
                ("dAvg_loss", ctypes.c_float),
                ("dTime", ctypes.c_double),
                ("weightName", ctypes.c_char * 128)]

class trainParameters(ctypes.Structure):
    _fields_ = [("modelWidth", ctypes.c_int),
                ("modelHeight", ctypes.c_int),
                ("modelChannel", ctypes.c_int),
                ("enumDeviceType",ctypes.c_int),
                ("enumModelType", ctypes.c_int),
                ("batch", ctypes.c_int),
                ("subdivisions", ctypes.c_int),
                ("width", ctypes.c_int),
                ("height", ctypes.c_int),
                ("max_batches", ctypes.c_int),
                ("learning_rate", ctypes.c_float),
                ("classes", ctypes.c_int),
                ("filters", ctypes.c_int)]

class detectionBox(ctypes.Structure):
    _fields_ = [("x", ctypes.c_uint),
              ("y", ctypes.c_uint),
              ("w", ctypes.c_uint),
              ("h", ctypes.c_uint),
              ("prob", ctypes.c_float),
              ("obj_id", ctypes.c_int)]

class testParameters(ctypes.Structure):
    _fields_ = [("modelWidth", ctypes.c_int),
                ("modelHeight", ctypes.c_int),
                ("modelChannel", ctypes.c_int),
                ("enumDeviceType",ctypes.c_int),
                ("enumModelType", ctypes.c_int),
                ("batch", ctypes.c_int),
                ("subdivisions", ctypes.c_int),
                ("width", ctypes.c_int),
                ("height", ctypes.c_int),
                ("max_batches", ctypes.c_int),
                ("learning_rate", ctypes.c_float),
                ("classes", ctypes.c_int),
                ("filters", ctypes.c_int)]

class bboxcomplex(ctypes.Structure):
    _fields_ = [("box", detectionBox * 1000)]

class InputImage(ctypes.Structure):
    _fields_ = [("h", ctypes.c_int),
                ("w", ctypes.c_int),
                ("c", ctypes.c_int),
                ("data",ctypes.c_char_p)]


